home *** CD-ROM | disk | FTP | other *** search
- { Demo program for "marching ants" marquee - John Jeppson }
-
- {$R-} { Turn off range checking }
- PROGRAM test;
-
- USES
- Memtypes, Quickdraw, OSIntf, ToolIntf, PackIntf,
- CursorCtl, { for the spinning cursor }
- Signal, { to handle command-period }
- PasLibIntf, { for standard I/O, etc. }
- IntEnv; { for argV and argC }
-
- VAR
- window: WindowPtr;
- theRect: Rect;
- marqueePattern: Pattern;
- theTicks: LONGINT;
-
- PROCEDURE initMarquee;
- BEGIN
- StuffHex( @marqueePattern, 'F8F1E3C78F1F3E7C' );
- END;
-
- PROCEDURE rotateByte( p: Ptr );
- INLINE $205F, $1010, $E218, $1080;
- {
- move.l (sp)+,a0
- move.b (a0),d0
- ror.b #1,d0
- move.b d0,(a0)
- }
-
- PROCEDURE rotatePattern( VAR thePat: Pattern );
- VAR
- i: INTEGER;
- BEGIN
- FOR i := 0 TO 7 DO
- rotateByte( @thePat[i] );
- END;
-
- PROCEDURE drawNextMarquee( r: Rect );
- BEGIN
- IF theTicks <> Tickcount THEN
- BEGIN
- theTicks := Tickcount;
- rotatePattern( marqueePattern );
- PenPat( marqueePattern );
- FrameRect( r );
- END;
- END;
-
- PROCEDURE makeWindow;
- VAR
- windowBounds: Rect;
- BEGIN
- SetRect( windowBounds, 50, 50, 300, 220 );
- window := NewWindow( NIL, windowBounds, 'Marquee', TRUE,
- documentProc, Pointer(-1), FALSE, 0 );
- SetPort( window );
- InitCursor;
- MoveTo( 47, 130 );
- DrawString( '-- click mouse to quit --' );
- END;
-
- FUNCTION haveEvent : Boolean;
- VAR
- thisEvent: EventRecord;
- BEGIN
- haveEvent := GetNextEvent( mDownMask, thisEvent );
- END;
-
- BEGIN
- InitGraf(@thePort);
- SetFScaleDisable(true);
-
- makeWindow;
- initMarquee;
-
- SetRect( theRect, 50, 30, 200, 100 );
-
- WHILE NOT haveEvent DO
- drawNextMarquee( theRect );
-
- DisposeWindow( window );
- END.